package model;

import java.io.Serializable;
import javax.persistence.*;

import dao.RouteDao;

import java.util.List;


/**
 * The persistent class for the route database table.
 * 
 */
@Entity
@NamedQuery(name="Route.findAll", query="SELECT r FROM Route r")
public class Route implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private String rname;

	private int days;

	private String info;

	private int money;

	private String rcname;

	//bi-directional many-to-one association to Rorder
	@OneToMany(mappedBy="route")
	private List<Rorder> rorders;

	//bi-directional many-to-one association to Vroute
	@OneToMany(mappedBy="route")
	private List<Vroute> vroutes;

	//bi-directional many-to-one association to Hroute
	@OneToMany(mappedBy="route")
	private List<Hroute> hroutes;
	
	public Route() {
	}

	public String getRname() {
		return this.rname;
	}

	public void setRname(String rname) {
		this.rname = rname;
	}

	public int getDays() {
		return this.days;
	}

	public void setDays(int days) {
		this.days = days;
	}

	public String getInfo() {
		return this.info;
	}

	public void setInfo(String info) {
		this.info = info;
	}

	public int getMoney() {
			return this.money;
	}

	public void setMoney(int money) {
		this.money = money;
	}

	public String getRcname() {
		return this.rcname;
	}

	public void setRcname(String rcname) {
		this.rcname = rcname;
	}

	public List<Rorder> getRorders() {
		return this.rorders;
	}
	
	

	public void setRorders(List<Rorder> rorders) {
		this.rorders = rorders;
	}

	public Rorder addRorder(Rorder rorder) {
		getRorders().add(rorder);
		rorder.setRoute(this);

		return rorder;
	}

	public Rorder removeRorder(Rorder rorder) {
		getRorders().remove(rorder);
		rorder.setRoute(null);

		return rorder;
	}

	public List<Vroute> getVroutes() {
		return this.vroutes;
	}

	public void setVroutes(List<Vroute> vroutes) {
		this.vroutes = vroutes;
	}

	public Vroute addVroute(Vroute vroute) {
		getVroutes().add(vroute);
		vroute.setRoute(this);

		return vroute;
	}

	public Vroute removeVroute(Vroute vroute) {
		getVroutes().remove(vroute);
		vroute.setRoute(null);

		return vroute;
	}
	
	public List<Hroute> getHroutes() {
		return this.hroutes;
	}

	public void setHroutes(List<Hroute> hroutes) {
		this.hroutes = hroutes;
	}

	public Hroute addHroute(Hroute hroute) {
		getHroutes().add(hroute);
		hroute.setRoute(this);

		return hroute;
	}

	public Hroute removeHroute(Hroute hroute) {
		getHroutes().remove(hroute);
		hroute.setRoute(null);

		return hroute;
	}

}